/**
 * 
 */
package com.wskj.library.service.impl;

import java.util.List;

import com.wskj.library.dao.EmployerDao;
import com.wskj.library.dao.RoleInfoDao;
import com.wskj.library.dao.impl.EmployerDaoImpl;
import com.wskj.library.dao.impl.RoleInfoDaoImpl;
import com.wskj.library.pojo.Employer;
import com.wskj.library.pojo.RoleInfo;
import com.wskj.library.service.EmployerService;

/**
 * @author 胡洋
 * @describe 
 * @Date 2018年3月23日下午4:30:16
 * @version 1.0
 */
public class EmployerServiceImpl implements EmployerService {
     private EmployerDao emDao=new EmployerDaoImpl();
	 private  RoleInfoDao roleDao=new RoleInfoDaoImpl();
	
    
	@Override
	public long getCountsByName(String name, String phone, String birthday) {
		
		
		return emDao.getCountsByName(name,phone,birthday);
	}



	
	@Override
	public List<Employer> queryEmployers(String name, String phone, String birthday, int index, int pageSize) {
		
		return emDao.getAllEmployersWithPage(name,phone,birthday,index,pageSize);
	}




	
	@Override
	public Employer getEmployerById(int uid) {
		
		return emDao.getEmployerById(uid);
	}

	
	@Override
	public Employer checkLogin(String account, String pass) {
		
		return emDao.checkLogin(account,pass);
	}


	@Override
	public boolean deletEmployerById(int eid) {
		int count = emDao.deleteById(eid);
		return count>0?true:false;
	}

	
	@Override
	public boolean saveEmployer(Employer employer) {
		int count = emDao.addEmployer(employer);
		return count>0?true:false;
	}


	
	@Override
	public boolean updateEmployer(Employer employer) {
		int count = emDao.updateEmployer(employer);
		return count>0?true:false;
	}




	
	@Override
	public List<RoleInfo> queryAllRoles() {		
		return roleDao.getAllRoleInfos();
	}



	@Override
	public boolean updatePassWord(int id, String pass) {
		int count=emDao.updateUserPass(id,pass);
		return count>0?true:false;
	}




	
	@Override 
	public boolean deleteAllEmployer(String[] id) {
		int count=emDao.deleteAllEmployer(id);
		return count>0?true:false;
	}




	
	@Override
	public List<Employer> queryAllEmployers() {
		
		return emDao.getAllEmployers();
	}




	
	@Override
	public boolean saveEmployerList(List<Employer> employers) {
		
		int count=emDao.saveEmployerList(employers);
		return count>0?true:false;
	}
	
	
	
	
	

}
